package com.zy.web.demo.duoxiancheng.demo17;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">zy</a>
 * @version 1.0
 * @date 2020/8/18 16:35
 */
public class Service17 {

    public void method(Object lock){
        try {
            synchronized (lock){
                System.out.println("begin wait");
                lock.wait();
                System.out.println("end wait");
            }
        }catch (InterruptedException e){
            e.printStackTrace();
            System.out.println("出现异常了，因为wait的情况下被interrupt了");
        }
    }

}
